<!DOCTYPE html>
<html>

<head>
<title>类别类型</title>
<meta http-equiv="Pragma" CONTENT="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="renderer" content="webkit">
<%include("/common/include.html"){}%>
</head>

<body class="easyui-layout">
	<div data-options="region:'center',fit:false,border:false,split:false">
		<div id="contentLayout" class="easyui-layout" data-options="fit:true">
			<div id="table_div" data-options="region:'center',border: false">
				<table id="plateTable" style="height: 100%">

				</table>

				<div id="tb" style="height: auto">
					<a href="#" onclick='addPlate()' class="easyui-linkbutton" iconCls="icon-add">添加</a>
					<a href="#" class="easyui-linkbutton" iconCls="icon-edit" onclick="editPlate()">修改</a>
					<a href="#" class="easyui-linkbutton" iconCls="icon-remove" onclick="deletePlate()">删除</a>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript">
	
	function addPlate(){
		loadDialog($("#plateTable"), null, '添加车辆信息', 'vehicleInformation/toAddVehicle');
	}
	function editPlate(){
		 var row = $("#plateTable").datagrid('getSelected');
		 if(row == null){
			 $.slideMsg("请选中一条记录！", parent.$);
		 }else{
			 loadDialog($("#plateTable"), null, '编辑车辆信息', 'vehicleInformation/toUpVehicle?ids=' + row.ids);
		 }
	}
	function deletePlate(){
		 var row = $("#plateTable").datagrid('getSelected');
		 if(row == null){
			 $.slideMsg("请选中一条记录！", parent.$);
		 }else{
			 var rowids = row.ids
			 
			 parent.$.messager.confirm('删除','确定删除？',function(r){
				if (r){
					$.post("vehicleInformation/vehicleListstruts",{"ids":rowids},function(result){
						$('#plateTable').datagrid('reload');
					});
				}
			 });
		 }
	}
	$(function() {
		$('#plateTable').datagrid({
			cls: "theme-datagrid",
			toolbar: '#tb',
			singleSelect: true,
			rownumbers: true, //显示序号
			pagination: true,
			pageSize: 10,
			url: "vehicleInformation/vehicleList",
			queryParams: {
				
			},
		    method: 'post',
			collapsible: true,
			columns:[[
				  		{field:'ids',title:'ids',width:100,align:'center', hidden:true},
				  		{field:'model',title:'型号',width:150, align:'center'},
				  		{field:'pp',title:'品牌',width:80,align:'center'},
				  		{field:'type',title:'类型',width:150, align:'center'},
				  		{field:'manufacturer',title:'生产厂家',width:180, align:'center'},
				  		{field:'birthday',title:'生产日期',width:150, align:'center'},
				  		{field:'imports',title:'是否国产',width:60, align:'center',
 				  			formatter: function(value,row,index){
				  				var imports = row.imports;
 				  				if(imports == 1){
 				  					return '<span class='+'l-btn-left'+'><span  style='+'color:red'+' class='+'l-btn-text'+'>否</span></span></a>';
 				  				}else {
				  					return '<a onclick='+'btn(\'' + row.ids + '\',0)'+' class='+'button-edit button-success  l-btn l-btn-small'+'><span class='+'l-btn-left'+'><span  style='+'color:green'+' class='+'l-btn-text'+'>是</span></span></a>';
 				  				}
 				  			}},
 				  		{field:'manu_contry',title:'制造国',width:60, align:'center'},
 				  		{field:'chang',title:'长(cm)',width:60, align:'center'},
				  		{field:'width',title:'宽(cm)',width:60, align:'center'},
				  		{field:'height',title:'高(cm)',width:60, align:'center'},
				  		{field:'color',title:'颜色',width:60, align:'center'},
				  		{field:'gl',title:'功率(W)',width:60, align:'center'},
 				  		{field:'weight',title:'车身质量</br>(公斤)',width:60, align:'center'}
				  		
				      ]],
			onLoadSuccess:function(){
				
			}
		});
	
	})
	</script>

</body>